import configparser

import os

cfig = configparser.ConfigParser()
file_path = 'config/config.ini'


def config(section):
    if os.path.exists(file_path):
        cfig.read(file_path)
        # value = cfig['select']['url']
        # value = config.get('select', 'url')
        value = cfig.items(section)
        data = {}
        for i in value:
            data[i[0]] = i[1]
        return data
    else:
        print('配置文件读取错误')
        return '配置文件读取错误'


print(f"http://{config('run')['host']}:{config('run')['port']}")
